# coding:utf-8

from django import forms
from captcha.fields import CaptchaField


class RegisterForm(forms.Form):
    gender = (('male', "男"), ('female', "女"))
    utype =  (('1', "教师"), ('2', "学生"))
    username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control'}))
    password1 = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password2 = forms.CharField(label="确认密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    email = forms.EmailField(label="邮箱地址", widget=forms.EmailInput(attrs={'class': 'form-control'}))
    sex = forms.ChoiceField(label='性别', choices=gender, widget=forms.RadioSelect)
    usertype = forms.ChoiceField(label='类型',choices=utype, widget=forms.RadioSelect)
    captcha = CaptchaField(label='验证码')

    def __init__(self,*args,**kwargs):
        #do something
        return super(RegisterForm,self).__init__(*args,**kwargs)

class CaptchaForm(forms.Form):
    captcha = CaptchaField(label='验证码')

class ChangeimageForm(forms.Form):
    image = forms.FileField()
    def __init__(self,*args,**kwargs):
        #do something
        return super(ChangeimageForm,self).__init__(*args,**kwargs)

class ChangepasswordForm(forms.Form):
    password = forms.CharField(label="原密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password1 = forms.CharField(label="新密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    password2 = forms.CharField(label="确认密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control'}))
    def __init__(self,*args,**kwargs):
        #do something
        return super(ChangepasswordForm,self).__init__(*args,**kwargs)
